package o2plalindrome;

import sun.rmi.runtime.Log;

/**
 * @author shkstart
 * @create 2021-12-27-21:55
 */
public class Solution01 {

    public static void main(String[] args) {

        boolean palindrome = isPalindrome(110011);

        System.out.println(palindrome);

    }

    public static boolean isPalindrome(int x) {

        // 负数不满足回文，直接淘汰
        if (x < 0) {
            return false;
        }

        // 将数字转换成字符串方便后续操作
        String number = x + "";

        char[] Lnumber = number.toCharArray();

        int length = Lnumber.length;

        char[] Rnumber = new char[length];

        int falg = 0;

        int num = 0;

        for (int i = Rnumber.length - 1; i >= 0; i--) {
            // 数字反转
            Rnumber[i] = Lnumber[i];

            falg = Rnumber[i] - '0';

            // 获取数字
            num = num * 10 + falg;

        }

        if (num == x) {
            return true;
        }

        return false;

    }
}
